
CC=gcc
C_FLAGS=-Wall -fPIC -c -g -O3
HEADERS=-I ../../src # These are the matvec headers.
LIBRARIES=-L../../src -L/usr/local/lib -lmatvec
VERSION=.0.0.1

JAVA_CLASSES=net.matvec.Vector net.matvec.Matrix
OBJS=net_matvec_VectorImp.o net_matvec_MatrixImp.o matrix_conv.o

JAVA_HEADERS=net_matvec_Vector.h net_matvec_Matrix.h

libjnimatvec.so: preamble $(OBJS)
	ld -shared -soname libjnimatvec.so -o libjnimatvec.so$(VERSION) $(OBJS) $(LIBRARIES)

preamble:
	javah -classpath ../build $(JAVA_CLASSES)

.c.o:
	$(CC) $(HEADERS) $(C_FLAGS) $<

install:
	cp libjnimatvec.so$(VERSION) /usr/local/lib
	ldconfig -n /usr/local/lib

clean:
	rm -f $(JAVA_HEADERS)
	rm -f libjnimatvec.so
	rm -f *.o
	rm -f *~
	rm -f /usr/local/lib/libjnimatvec.*
